/*
 * @Author: Kiro AI Assistant
 * @Date: 2025-01-10
 * @Description: 音乐API异常类 - 定义音乐相关的网络异常
 */

/// 音乐API异常基类
abstract class MusicApiException implements Exception {
  final String message;
  final String? code;
  final dynamic originalError;

  const MusicApiException(this.message, {this.code, this.originalError});

  @override
  String toString() => 'MusicApiException: $message';
}

/// 网络连接异常
class NetworkException extends MusicApiException {
  const NetworkException(super.message, {super.code, super.originalError});

  @override
  String toString() => 'NetworkException: $message';
}

/// 音频播放异常
class AudioException extends MusicApiException {
  const AudioException(super.message, {super.code, super.originalError});

  @override
  String toString() => 'AudioException: $message';
}

/// 搜索异常
class SearchException extends MusicApiException {
  const SearchException(super.message, {super.code, super.originalError});

  @override
  String toString() => 'SearchException: $message';
}

/// 播放链接获取异常
class PlayUrlException extends MusicApiException {
  const PlayUrlException(super.message, {super.code, super.originalError});

  @override
  String toString() => 'PlayUrlException: $message';
}

/// 数据解析异常
class ParseException extends MusicApiException {
  const ParseException(super.message, {super.code, super.originalError});

  @override
  String toString() => 'ParseException: $message';
}

/// 权限异常
class PermissionException extends MusicApiException {
  const PermissionException(super.message, {super.code, super.originalError});

  @override
  String toString() => 'PermissionException: $message';
}

/// 服务不可用异常
class ServiceUnavailableException extends MusicApiException {
  const ServiceUnavailableException(super.message,
      {super.code, super.originalError});

  @override
  String toString() => 'ServiceUnavailableException: $message';
}
